<?php


namespace App\Admin\Repositories;

use App\Models\Cities;
use Dcat\Admin\Grid;
use Dcat\Admin\Repositories\EloquentRepository;

class BaseRepository extends EloquentRepository
{

    public function get(Grid\Model $model)
    {
        $where=[];
        $city = config('setting.city');
        $data = Cities::where('pid',0)->get()->toArray();
        foreach ($data as $value){
            if ($city == $value['name']){
                $where['province'] = $value['id'];
            }
        }
        $model = $model->where($where);
        return parent::get($model); // TODO: Change the autogenerated stub
    }
}
